package com.jbit.dm212.common;

import com.jbit.dm212.entity.po.DmUser;

public class UserUtil {
    //是个线程类  数据保存是以当前线程为key
    private static ThreadLocal threadLocal = new ThreadLocal();
    //添加值的时候,key为当前线程
    public static void setUser(DmUser user){
        threadLocal.set(user);
    }

    //获取值的时候,key为当前线程
    public static DmUser getUser(){
        return (DmUser) threadLocal.get();
    }
}
